<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <!--[if lt IE 9]>
    <script type="text/javascript" src="../../../lib/html5shiv.js?rev=@@hash"></script>
    <script type="text/javascript" src="../../../lib/respond.min.js?rev=@@hash"></script>
    <![endif]-->
    <link rel="stylesheet" type="text/css" href="../../../static/h-ui/css/H-ui.min.css" />
    <link rel="stylesheet" type="text/css" href="../../../static/h-ui.admin/css/H-ui.admin.css" />
    <link rel="stylesheet" type="text/css" href="../../../lib/Hui-iconfont/1.0.8/iconfont.css" />
    <link rel="stylesheet" type="text/css" href="../../../static/h-ui.admin/skin/default/skin.css" id="skin" />
    <link rel="stylesheet" type="text/css" href="../../../static/h-ui.admin/css/style.css" />
    <link rel="stylesheet" type="text/css" href="../../../lib/Validform/5.3.2/style.css" />
    <link rel="stylesheet" type="text/css" href="../../../ht-css/Project.css" />
    <link rel="stylesheet" type="text/css" href="../../../ht-css/jedate.css" />
    <!--[if IE 6]>
    <script type="text/javascript" src="../../../lib/DD_belatedPNG_0.0.8a-min.js?rev=@@hash"></script>
    <script>DD_belatedPNG.fix('*');</script>
    <![endif]-->
    <title>方盛云仓订单查询</title>
</head>
<body data-id="519">
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页  <span class="c-gray en">&gt;</span>订单管理 <span class="c-gray en">&gt;</span> 方盛云仓订单查询<a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<article class="page-container">
    <div class="ml-20 mr-20">
        <div class="bg-1 bk-gray pb-10">
            <form id="form-search">
                <div class="pl-10 lh-30 mb-10">
                    <div class="line mb-10"></div>
                    <table class="table-hover table_li ml-10 mb-10 table">
                        <thead class="text-l">
                        <tr>
                            <td class="col-6-1">
                                <div class="row ml-10">
                                    <label class="form-label f-l pt-5 text-r w-75">客户名称：</label>
                                    <div class="formControls col-xs-8 col-sm-9">
                                        <input type="text" class="input-text radius w-180 f-l"  id="customerName" name="houseName" placeholder="请输入客户名称" >
                                    </div>
                                </div>
                            </td>
                            <td class="col-6-1">
                                <div class="row ml-10">
                                    <label class="form-label f-l pt-5 text-r w-75">客户平台：</label>
                                    <div class="formControls col-xs-8 col-sm-9">
                                        <input type="text" class="input-text radius w-180 f-l"  id="housdeNamse" name="houseName" placeholder="请输入客户平台" >
                                    </div>
                                </div>
                            </td>
                            <td class="col-6-1">
                                <div class="row ml-10">
                                    <label style="margin-left: -12px;" class="form-label f-l pt-5 text-r w-75">云仓名称：</label>
                                    <div class="formControls col-xs-8 col-sm-9">
                                        <input type="text" class="input-text radius w-180 f-l"  id="houseName" name="houseName" placeholder="请输入云仓名称" >
                                    </div>
                                    <span class="Validform_checktip"></span>
                                </div>
                            </td>


                        </tr>
                        <tr>
                            <td class="col-6-1">
                                <div class="row ml-10">
                                    <label class="form-label f-l pt-5 text-r w-75">云仓ID：</label>
                                    <div class="formControls col-xs-8 col-sm-9">
                                        <input type="text" class="input-text radius w-180 f-l"  id="houseId" name="houseId" placeholder="请输入云仓ID" >
                                    </div>
                                </div>
                            </td>

                            <td class="col-6-1">
                                <div class="row ml-10">
                                    <label class="form-label f-l pt-5 text-r w-75">客户ID：</label>
                                    <div class="formControls col-xs-8 col-sm-9">
                                        <input type="text" class="input-text radius w-180 f-l"  id="customerId" name="customerId" placeholder="输入客户ID" >
                                    </div>
                                </div>
                            </td>
                            <td class="col-6-1">
                                <div class="row ml-10">
                                    <label style="width: 70px;margin-top: 8px;" class="form-label f-l label-4">客户归属：</label>
                                    <select id="ascription_lsit" class="select radius f-l ml-10" name="brandclass" size="1" style="width:43%; height: 29px;margin-left: 4px;">
                                        <script id="ascription_bob" type="text/x-dot-template">
                                            <option disabled="disabled" selected>请选择</option>
                                            {{if( it && it.length>0 ){ }}
                                            {{ for(var i=0; i< it.length; i++) { }}
                                            <option value="{{=it[i].id}}">{{=it[i].organization_name}}</option>
                                            {{ } }}
                                            {{ }else{ }}
                                            <option>没有数据</option>
                                            {{ } }}
                                        </script>
                                    </select>
                                </div>
                            </td>

                        </tr>
                        <tr>
                            <td class="col-6-1">
                                <div class="row ml-10">
                                    <label class="form-label f-l pt-5 text-r w-85" style="width: 75px;">时间范围：</label>
                                    <div class="f-l ml-10" >
                                        <input onfocus="WdatePicker({ maxDate:'#F{$dp.$D(\'timemax\')||\'%y-%M-%d\'}',startDate:'%y-%M-01 00:00:00',dateFmt:'yyyy-MM-dd HH:mm:ss'})" class="input-text Wdate radius" id="timemin" type="text" placeholder="起始时间" style="width:116px;"  autocomplete="off">
                                        ~
                                        <input onfocus="WdatePicker({ minDate:'#F{$dp.$D(\'timemin\')}',dateFmt:'yyyy-MM-dd HH:mm:ss'})" class="input-text Wdate radius" id="timemax" type="text" placeholder="结束时间" style="width:116px;" autocomplete="off">
                                    </div>
                                </div>
                            </td>
                        </tr>
                        </thead>
                    </table>
                </div>
                <div class="text-c pb-20 pt-10">
                    <input type="button" onclick="fsorderlist()" class="btn btn-secondary radius size-S " value="搜&nbsp;&nbsp;索">
                    <input name="" type="reset" onclick="resetDivdd()" class="btn radius size-S ml-10" value="重&nbsp;&nbsp;置">
                    <a  onclick="daochu()" class="btn btn-secondary radius size-S ml-10" href="" id="lkkk">导出EXCEL</a>

                </div>
            </form>
            <table class="table table-border table-bg table-hover table-sort mt-10" id="tabletables">
                <thead>
                <tr class="text-c">
                    <th width="50">序号</th>
                    <th width="50">订单号</th>
                    <th width="50">云仓名称</th>
                    <th width="50">客户名称</th>
                    <th width="50">客户归属</th>
                    <th width="50">下单时间</th>
                    <th width="50">下单账号</th>
                    <th width="50">订单金额</th>
                    <th width="50">交易状态</th>
                    <th width="50">操作</th>
                </tr>
                </thead>
                <tbody class="shun">

                </tbody>
            </table>
            <div class="dataTables_wrapper goods_fanye clearfix mt-5">
                <div class="f-r pageturning M-box3"></div>
            </div>
        </div>
    </div>
</article>
<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="../../../lib/jquery/1.9.1/jquery.min.js?rev=@@hash"></script>
<script type="text/javascript" src="../../../lib/layer/2.4/layer.js?rev=@@hash"></script>
<script type="text/javascript" src="../../../static/h-ui/js/H-ui.min.js?rev=@@hash"></script>
<script type="text/javascript" src="../../../static/h-ui.admin/js/H-ui.admin.js?rev=@@hash"></script> <!--/_footer 作为公共模版分离出去-->
<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="../../../lib/jquery.jedate.min.js?rev=@@hash"></script>
<!--表单验证-->
<script type="text/javascript" src="../../../lib/jquery.validation/1.14.0/jquery.validate.js?rev=@@hash"></script>
<script type="text/javascript" src="../../../lib/jquery.validation/1.14.0/validate-methods.js?rev=@@hash"></script>
<script type="text/javascript" src="../../../lib/jquery.validation/1.14.0/messages_zh.js?rev=@@hash"></script>
<script type="text/javascript" src="../../../lib/datatables/1.10.0/jquery.dataTables.min.js?rev=@@hash"></script>
<script type="text/javascript" src="../../../lib/laypage/1.2/laypage.js?rev=@@hash"></script>
<script type="text/javascript" src="../../../lib/Validform/5.3.2/Validform_v5.3.2_min.js?rev=@@hash"></script>
<script type="text/javascript" src="../../../lib/My97DatePicker/4.8/WdatePicker.js?rev=@@hash"></script>

<!--引入分页-->
<link rel="stylesheet" href="../../../lib/pagination/pagination.css">
<!--权限控制-->
<script type="text/javascript" src="../../../ht-js/power.js?rev=@@hash"></script>

<script src="../../../lib/pagination/jquery.pagination.js?rev=@@hash"></script>
<script src="../../../ht-js/public.js?rev=@@hash"></script>
<!--验证token-->
<script src="../../../ht-js/verifyToken.js?rev=@@hash"></script>
<script src="../../../ht-js/frame/doT.min.js?rev=@@hash"></script>
<script>
    $(function(){
        ascription()
        $("#form-search").Validform({
            tiptype:2,
            callback:function(form){
                getList(1)
                return false;
            }
        });
    })
    function resetDivdd() {
        location.replace(location.href);

    }
    function fsorderlist() {
        var okk=""
        if($("#ascription_lsit option:selected").text()=="请选择"){
            okk=""
        }else {
            okk=$("#ascription_lsit option:selected").text()
        }

        $.ajax({
            url:'https://'+ window.location.host +'/api/admin/anobodyhouse/adminSearchHouseOrderService',
            cache: false,  //禁用缓存
            type: "POST",
            dataType:'json',
            contentType: "application/json",
            data: JSON.stringify({
                "pageSize":"30",
                "pageNumber":"1",
                "startTime":$("#timemin").val(),
                "endTime":$("#timemax").val(),
                "houseId":$("#houseId").val(),
                "houseName":$("#houseName").val().trim(),
                "groupName":okk,//客户归属
                "customerName":$("#customerName").val().trim(),//客户名称
                "customerId":$("#customerId").val().trim(),//客户id
            }),
            success: function (data) {
                if(data.errorCode==0){
                    couponlist1(data.data, 0);
                }else {
                    couponlist1("", 0);
                }
            var pl=""
                console.log(data.data.data)
                if(data.data.data==""){
                    pl="0"
                }else {
                    pl=data.data.pageCount
                }
                $('.M-box3').pagination({
                    pageCount:pl ,
                    jump: true,
                    coping: true,
                    prevContent: '上页',
                    nextContent: '下页',
                    callback: function (api) {
                        console.log(api)
                        $.ajax({
                            url:'https://'+ window.location.host +'/api/admin/anobodyhouse/adminSearchHouseOrderService',
                            cache: false,  //禁用缓存
                            type: "POST",
                            dataType:'json',
                            contentType: "application/json",
                            data: JSON.stringify({
                                "pageNumber":api.getCurrent(),
                                "pageSize":30,
                                "startTime":$("#timemin").val(),
                                "endTime":$("#timemax").val(),
                                "houseId":$("#houseId").val(),
                                "houseName":$("#houseName").val(),
                                "groupName":okk,//客户归属
                                "customerName":$("#customerName").val(),//客户名称
                                "customerId":$("#customerId").val(),//客户id
                            }),
                            success: function (result) {
                                console.log(result)
                                couponlist1(result.data);
                            },
                            error: function (XMLHttpRequest, textStatus, errorThrown) {
                                alert(XMLHttpRequest);
                            }
                        });
                    }
                });

            },
            error: function () {
                $.Huimodalalert('失败！',2000);
            }
        });
    }
    var dataSource = new Array();
    //table的数据源
    var table;   //table对象
    dataSource = [];
    function couponlist1(data, index){
        sessionStorage.setItem("authorizedUsers", JSON.stringify(data));
        dataSource.splice(0,dataSource.length);//清空数组
        var datashu =data.startRow+1;
        $.each(data.data, function (i, field) {
            var datashus = datashu++
            var rowData = new Array();
            rowData.push(field.house_order_id);
            rowData.push(field.house_name);
            rowData.push(field.customerInfo);
            rowData.push(field.group_name);
            rowData.push(field.created_time);
            rowData.push(field.login_account);
            rowData.push(field.order_money);
            rowData.push(field.order_status);
            rowData.push(datashus);
            dataSource.push(rowData);

        });

        initData(dataSource);

        function initData(dataSource) {

            var dttable = $('#tabletables').dataTable(); // 初始化dataTable，清空上一个值
            dttable.fnClearTable(); //清空一下table
            dttable.fnDestroy(); //还原初始化了的datatable
            $("#tabletables").DataTable({
                "autoWidth": false,
                "ordering": false,
                "searching": false,
                "paging": false,
                "retrieve": false,
                "destroy": true,
                "bAutoWidth": false,
                "bLengthChange": false,
                "aLengthMenu": [20],
                "oLanguage": {
                    "sLengthMenu": "每页显示 _MENU_ 条记录",
                    "sZeroRecords": "抱歉， 没有找到",
                    "sInfo": "从 _START_ 到 _END_ /共 _TOTAL_ 条数据",
                    "sInfoEmpty": "没有数据",
                    "sInfoFiltered": "(从 _MAX_ 条数据中检索)",
                    "oPaginate": {
                        "sFirst": "首页",
                        "sPrevious": "前一页",
                        "sNext": "后一页",
                        "sLast": "尾页"
                    },
                    "sZeroRecords": "没有检索到数据",
                },
                data: dataSource,
                columnDefs: [
                    {
                        "visible": true,
                        "targets": 0
                    },
                    {
                        "render": function (data, type, row, meta) {
                            var val = row[8]
                            if (val == undefined) {
                                val = ''
                            }
                            return val;
                        },
                        "targets": 0
                    },
                    {
                        "render": function (data, type, row, meta) {
                            var val = row[0]
                            if (val == undefined) {
                                val = ''
                            }
                            return val;
                        },
                        "targets": 1
                    },
                    {
                        "render": function (data, type, row, meta) {
                            var val = row[1]
                            if (val == undefined) {
                                val = ''
                            }
                            return val;
                        },
                        "targets": 2
                    },
                    {
                        "render": function (data, type, row, meta) {
                            var val = row[2]
                            if (val == undefined) {
                                val = ''
                            }
                            return val;
                        },
                        "targets": 3
                    },
                    {
                        "render": function (data, type, row, meta) {
                            var val = row[3]
                            if (val == undefined) {
                                val = ''
                            }
                            return val;
                        },
                        "targets": 4
                    },
                    {
                        "render": function (data, type, row, meta) {
                            var val = row[4]
                            if (val == undefined) {
                                val = ''
                            }
                            return val;
                        },
                        "targets": 5
                    },


                    {
                        "render": function (data, type, row, meta) {
                            var val = row[5]
                            if (val == undefined) {
                                val = ''
                            }
                            return val;
                        },
                        "targets": 6
                    },
                    {
                        "render": function (data, type, row, meta) {
                            var f = Math.round(row[6]*100)/100;
                            var s = f.toString();
                            var rs = s.indexOf('.');
                            if (rs < 0) {
                                rs = s.length;
                                s += '.';
                            }
                            while (s.length <= rs + 2) {
                                s += '0';
                            }
                            return s;
                        },
                        "targets": 7
                    },
                    {
                        "render": function (data, type, row, meta) {

                            if (row[7] == 10) {
                                var val = "订单成功"
                                return val;
                            }

                        },
                        "targets": 8
                    },
                    {
                        "render": function (data, type, row, meta) {
                          var  val = '<a onclick="fsxq(\'方盛云仓订单详情\',\'fsprepare.html\',\''+row[0]+'\')">查看详情</a>&nbsp;&nbsp;<a onclick="tuihuo(\''+row[0]+'\')">订单退货</a>';
                            return val;
                        },
                        "targets":9
                    },

                ]
            });
        };
    }

 function fsxq(title,url,data){
            sessionStorage.setItem("sforderId",data);
            var index = layer.open({
                type: 2,
                title: title,
                content: url
            });
            layer.full(index);
    }
    //初始化客户归属下拉列表
    function ascription() {
        var user_data = {
            organizationIds:sessionStorage.getItem("companys"),//销售归属权限串
        }
        var succCallBack = function (data, status, response) {
            //console.log(data)
            if(data.errorCode=="0") {
                var dataInter=data.group;
                var interText = doT.template($("#ascription_bob").text());
                $("#ascription_lsit").html(interText(dataInter));
            }
        };
        return web.doAjax(root.inter.getGroup, 'post', user_data, succCallBack);
    }
    function daochu() {
        var okk=""
        if($("#ascription_lsit option:selected").text()=="请选择"){
            okk=""
        }else {
            okk=$("#ascription_lsit option:selected").text()
        }
        $('#lkkk').attr('href','https://'+ window.location.host +'/api/admin/anobodyhouse/houseProductExcel'+"?houseId="+$("#houseId").val()+"&startTime="+$("#timemin").val()
            +"&endTime="+$("#timemax").val()+"&houseName="+$("#houseName").val()+"&groupName="+okk+"&customerName="+$("#customerName").val()+"&customerId="+$("#customerId").val()
        );

    }
    
    function tuihuo(id) {
        var user_data = {
            orderId:id,
        }
        var succCallBack = function (data, status, response) {
            //console.log(data)
            if(data.errorCode=="0") {
                $.Huimodalalert('退货成功',2000);
            }else {
                $.Huimodalalert(data.msg,2000);
            }
        };
        return web.doAjax('https://'+ window.location.host +'/api/admin/anobodyhouse/deleteOrder', 'post', user_data, succCallBack);
    }
</script>
</body>
</html>